﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Item.aspx.cs" Inherits="WebService.Item" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Item Page - GPS Travel</title>
    <style type="text/css">
        .style1
        {
            width: 1633px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table style="width:100%;">
            <tr>
                <td>
                    &nbsp;</td>
                <td class="style1">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td style="font-weight: 700" class="style1">
                    Item List 
                    | Go to
                    <asp:HyperLink ID="HyperLink3" runat="server" 
                        NavigateUrl="~/Admin/Category.aspx" style="text-align: right">CategoryList Page</asp:HyperLink>
&nbsp;
| Go to
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Admin/ListPlaces.aspx" 
                        style="text-align: right">ListPlaces Page</asp:HyperLink>
&nbsp;| Go to
                    <asp:HyperLink ID="HyperLink5" runat="server" 
                        NavigateUrl="~/Admin/DeviceItem.aspx" style="text-align: right">Device List Page </asp:HyperLink>
&nbsp;| Go to
                    <asp:HyperLink ID="HyperLink2" runat="server" 
                        NavigateUrl="~/Admin/DeviceHistory.aspx" style="text-align: right">DeviceHistory Page</asp:HyperLink>
&nbsp;| Go to
                    <asp:HyperLink ID="HyperLink6" runat="server" 
                        NavigateUrl="~/Admin/ItemsMultilang.aspx" style="text-align: right">Item List Multilang Page </asp:HyperLink>
&nbsp;| Go to
                    <asp:HyperLink ID="HyperLink7" runat="server" 
                        NavigateUrl="~/Admin/CategoryMultilang.aspx" style="text-align: right">Category Multilang Page</asp:HyperLink>
&nbsp;| Go to
                    <asp:HyperLink ID="HyperLink8" runat="server" 
                        NavigateUrl="~/Admin/Languages.aspx" style="text-align: right">Language Page</asp:HyperLink>
&nbsp;| Return
                    <asp:HyperLink ID="HyperLink4" runat="server" 
                        NavigateUrl="~/Admin/Default.aspx" style="text-align: right">Admin Page</asp:HyperLink>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td class="style1">
                    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1"
            onsorting="ListView1_Sorting"  InsertItemPosition="LastItem" 
            onitemcommand="ListView1_ItemCommand">
            <LayoutTemplate>
                <table border="0" cellpadding="1">
                    <tr style="background-color:#E5E5FE">
                        <th align="left"><asp:LinkButton ID="lnkItemId" runat="server" CommandName="Sort" CommandArgument="ItemID">Item Id</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkItemName" runat="server" CommandName="Sort" CommandArgument="ItemName">Item Name</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkCategoryId" runat="server" CommandName="Sort" CommandArgument="CategoryID">Category</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkRate" runat="server" CommandName="Sort" CommandArgument="Rate">Rate</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkAddress" runat="server" CommandName="Sort" CommandArgument="Address">Address</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkPhone" runat="server" CommandName="Sort" CommandArgument="Phone">Phone</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkEmail" runat="server" CommandName="Sort" CommandArgument="Email">Email</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkNote" runat="server" CommandName="Sort" CommandArgument="Note">Note</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkX" runat="server" CommandName="Sort" CommandArgument="X">X</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkY" runat="server" CommandName="Sort" CommandArgument="Y">Y</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkImage" runat="server" CommandName="Sort" CommandArgument="Image">Image</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkCountRate" runat="server" CommandName="Sort" CommandArgument="CountRate">CountRate</asp:LinkButton></th>
                        <th align="left"><asp:LinkButton ID="lnkChecked" runat="server" CommandName="Sort" CommandArgument="Checked">Checked</asp:LinkButton></th>
                        <th></th>
                    </tr>
                    <tr id="itemPlaceholder" runat="server"></tr>
                </table>
                <asp:DataPager ID="ItemDataPager" runat="server" PageSize="20">
                    <Fields>
                        <asp:NumericPagerField ButtonCount="10" />
                    </Fields>
                </asp:DataPager>    
            </LayoutTemplate>
            <ItemTemplate>
                    <tr>
                        <td><asp:Label runat="server" ID="lblId"><%#Eval("ItemID")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblName"><%#Eval("ItemName")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblCategoryID"><%#Eval("CategoryName")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblRate"><%#Eval("Rate")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblAddress"><%#Eval("Address")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblPhone"><%#Eval("Phone")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblEmail"><%#Eval("Email")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblNote"><%#Eval("Note")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblX"><%#Eval("X")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblY"><%#Eval("Y")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblImage"><%#Eval("Image")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblCountRate"><%#Eval("CountRate")%></asp:Label></td> 
                        <td><asp:Label runat="server" ID="lblChecked"><%#Eval("Checked")%></asp:Label></td>
                        <td><asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton></td>
                    </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                    <tr style="background-color:#EFEFEF">
                        <td><asp:Label runat="server" ID="lblId"><%#Eval("ItemID")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblName"><%#Eval("ItemName")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblCategory"><%#Eval("CategoryName")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblRate"><%#Eval("Rate")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblAddress"><%#Eval("Address")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblPhone"><%#Eval("Phone")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblEmail"><%#Eval("Email")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblNote"><%#Eval("Note")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblX"><%#Eval("X")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblY"><%#Eval("Y")%></asp:Label></td>
                        <td><asp:Label runat="server" ID="lblImage"><%#Eval("Image")%></asp:Label></td> 
                        <td><asp:Label runat="server" ID="lblCountRate"><%#Eval("CountRate")%></asp:Label></td>  
                        <td><asp:Label runat="server" ID="lblChecked"><%#Eval("Checked")%></asp:Label></td>
                        <td><asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton></td>
                    </tr>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                    <td>
                        <asp:TextBox ID="txtUpItemId" runat="server" Text='<%#Eval("ItemId") %>' Enabled="false"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpItemName" runat="server" Text='<%#Eval("ItemName") %>'></asp:TextBox>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlUpCategoryID" runat="server" DataSourceID="SqlDataSource2" DataTextField="CategoryName" DataValueField="CategoryID" Width="100px"></asp:DropDownList>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpRate" runat="server" Text='<%#Eval("Rate") %>' Enabled="false"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpAddress" runat="server" Text='<%#Eval("Address") %>' TextMode="MultiLine"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpPhone" runat="server" Text='<%#Eval("Phone") %>'></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpEmail" runat="server" Text='<%#Eval("Email") %>'></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpNote" runat="server" Text='<%#Eval("Note") %>' TextMode="MultiLine"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpX" runat="server" Text='<%#Eval("X") %>'></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpY" runat="server" Text='<%#Eval("Y") %>'></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpImage" runat="server" Text='<%#Eval("Image") %>'></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUpCountRate" runat="server" Text='<%#Eval("CountRate") %>' Enabled="false"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtChecked" runat="server" Text='<%#Eval("Checked") %>'></asp:TextBox>
                    </td>
                     <td>   
                            <asp:LinkButton ID="lnkUpdate" runat="server" CommandName="Update">Update</asp:LinkButton>
                            <asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
                            <asp:LinkButton ID="lnkCancel" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
                    </td>
                    
                </tr>
            </EditItemTemplate>
            <InsertItemTemplate>
                <tr id="Tr1" runat="server">
                    <td></td>
                    <td>
                        <asp:TextBox ID="txtItemName" runat="server" Text='<%#Eval("ItemName") %>'></asp:TextBox>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlCategoryID" runat="server" DataSourceID="SqlDataSource2" DataTextField="CategoryName" DataValueField="CategoryID"></asp:DropDownList>
                    </td>
                    <td>
                        <asp:TextBox ID="txtRate" runat="server" Text='<%#Eval("Rate") %>' Enabled="false"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtAddress" runat="server" Text='<%#Eval("Address") %>' ></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtPhone" runat="server" Text='<%#Eval("Phone") %>' ></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtEmail" runat="server" Text='<%#Eval("Email") %>' ></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtNote" runat="server" Text='<%#Eval("Note") %>' TextMode="MultiLine"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtX" runat="server" Text='<%#Eval("X") %>' ></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtY" runat="server" Text='<%#Eval("Y") %>' ></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtImage" runat="server" Text='<%#Eval("Image") %>' ></asp:TextBox>
                    </td>
              
                    <td>
                        <asp:TextBox ID="txtCountRate" runat="server" Text='<%#Eval("CountRate") %>' Enabled="false"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtChecked" runat="server" Text='<%#Eval("Checked") %>'></asp:TextBox>
                    </td>
                     <td><asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" /></td>
                    
                </tr>
            </InsertItemTemplate>
            
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:GPSTravelConnect %>" 
            SelectCommand="SELECT * FROM [tbl_Items] a, [tbl_Category] b WHERE a.CategoryID=b.CategoryID " >
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:GPSTravelConnect %>" 
            SelectCommand="SELECT * FROM [tbl_Category]" >
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:GPSTravelConnect %>" 
            SelectCommand="SELECT CategoryName FROM [tbl_Category]" >
        </asp:SqlDataSource>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td class="style1">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
